
package com.mp.chart.buffer;



import com.mp.chart.data.SarEntry;

import java.util.List;

public class SarPointBuffer extends AbstractBuffer<SarEntry> {

    public SarPointBuffer(int size) {
        super(size);
    }

    protected void addForm(float x, float y) {
        buffer[index++] = x;
        buffer[index++] = y;
    }

    @Override
    public void feed(List<SarEntry> entries) {

        int size = (int) Math.ceil((mTo - mFrom) * phaseX + mFrom);

        for (int i = mFrom; i < size; i++) {

            SarEntry e = entries.get(i);
            addForm(e.getXIndex(), e.getSar() * phaseY);
        }

        reset();
    }
}
